import random
from flask import Flask, jsonify

app = Flask(__name__)

def choujiang():
    return random.randint(1, 100)

@app.route('/choujiang')
def get_choujiang():
    return jsonify({'code': 0, 'data': {'choujiang': choujiang()}})

@app.route('/')
def index():
    return 'Welcome to choujiang API'   

@app.errorhandler(404)
def page_not_found(e):
    return jsonify({'code': 1, 'error': 'Page not found'}), 404

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000, debug=True)
